import 'package:liuxlcommon/util/toast_util.dart';
import 'package:ladder_cash/app/com/view/my_app_bar.dart';
import 'package:ladder_cash/generated/l10n.dart';
import 'package:ladder_cash/value/app_colors.dart';
import 'package:ladder_cash/value/app_lstyle.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:liuxlcommon/view/lxl_widget.dart';
import 'package:liuxlcommon/view/my_box.dart';
import 'package:liuxlcommon/view/my_style.dart';
import 'package:ladder_cash/app/app.dart';
import 'package:ladder_cash/generated/assets.dart';

class CancellationPage extends StatefulWidget {
  const CancellationPage({Key? key}) : super(key: key);

  @override
  _CancellationPageState createState() => _CancellationPageState();
}

class _CancellationPageState extends State<CancellationPage> {
  var agree = false;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: MyAppBar(S.current.accountCancellation),
      backgroundColor: Colors.white,
      body: Stack(
        children: [
          // Image.asset(
          //   Assets.bPdetailbg,
          //   width: double.infinity,
          //   height: 150.w,
          //   fit: BoxFit.fill,
          //
          // ),
          LColumn(lStyle: LStyle(), children: [
            [
              12.lsh,
              // 50.lsh,
              // // LImage.easy(Assets.icPinjamZhuxiao, 36.w, 38.w),
              // 16.lsh,
              LText(S.current.accountCancellationT1, lStyle: LStyle(textAlign: TextAlign.center, css: '''
                width: 311px;
                height: 210px;
                font-size: 16px;
                font-family: PingFangSC, PingFang SC;
                font-weight: 400; 
                color: #22335D;
                line-height: 30px;
                font-size: 16px;
                font-weight: 600;
                color: #F25C05;
            ''')),
              24.lsh,
              LText(S.current.accountCancellationT2, lStyle: LStyle(textAlign: TextAlign.center,
                  color: AppColors.primaryColor,
                  css: '''
                width: 292px;
                font-size: 16px;
                font-weight: 600; 
                text-align:center;
            ''')),
            ].column.css('''width: 343px;
          background: #F5F5F5;
          border-radius: 8px;
          padding: 16px;'''),
            15.lsh,
            LExpand(),
            xyBox,
            21.lsh,
            LText(S.current.accountCancellation, lStyle: rzBtnSty, onTap: () {
              if (agree) {
                App.logout();
              } else {
                ToastUtils.toast(App.localeEn ? "Please agree to the agreement" : "Por favor acepta el acuerdo");
              }
            }),
            45.lsh
          ]),
        ],
      ),
    );
  }

  get itemBox => LStyle(height: 56.w, padding: EdgeInsets.symmetric(horizontal: 16.w));

  Widget get xyBox => [
        LRow(
          lStyle: LStyle(width: double.infinity, crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center),
          children: [
            LImage(
              agree ? Assets.molopNewSelectyes : Assets.molopNewSelectno,
              lStyle: LStyle(padding: EdgeInsets.all(6.w), height: 30.w, margin: EdgeInsets.symmetric(horizontal: 0.w)),
              onTap: () {
                agree = !agree;
                setState(() {});
                ;
              },
            ),
            LSizeBoxWidth(5.w),
            LText.easy(S.current.accountCancellationT3, 14.sp, FontWeight.w400, AppColors.textColor),
          ],
        ),
      ].column;
}
